package com.example.demo.demos.web.mapper;

import com.example.demo.demos.web.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

@Select("select * from user where username=#{username} and password=#{password}")
List<User> selects(@Param("username") String username,@Param("password") String password);

@Insert("insert into user (username,password,type,status) VALUES (#{username},#{password},#{type},#{status})")
    int addUser(User user);
@Update("update user set username=#{username},password=#{password},type=#{type},status=#{status},phone=#{phone},email=#{email},fjly=#{fjly},avator=#{avator},name=#{name} where id=#{id}")
    int updateUser(User user);
    @Select("select * from user where username like concat('%',#{username},'%') and type=2 limit #{pageNum},#{pageSize}")
    List<User> selectuser(@Param("username") String username,@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize);
@Select("select count(*) from user where username like concat('%',#{username},'%') and type=2")
    Integer usertotal(@Param("username") String username);

}

